<%-- 
    Document   : AssessmentForm
    Created on : Jan 3, 2012, 9:41:41 PM
    Author     : Priyanka
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html"  prefix="html" %> 
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="/struts-tags" prefix="s" %>

<s:form name="form" action="/assessment/create">
    <label><b> Assessment Details below :</b> </label>
    <br/>
    <br/>
    <table>
        <tr>
            <td class="tdLabel">
                Title:
            </td>
            <td>
                <s:textfield name="ass.title" size="30" readonly="update"/> 
                <s:fielderror><s:param>ass.title</s:param></s:fielderror>
            </td>
        </tr>
        <tr>
            <td class="tdLabel">Description:</td>
            <td><s:textfield name="ass.description" size="30"/> 
            </td>
        </tr>
        <tr>
            <td class="tdLabel">Maximum Marks:</td>
            <td><s:textfield name="ass.maximumMark" size="40"/> 
            </td>
        </tr>
        <tr>
            <td class="tdLabel">Type of Assessment:</td>
            <td>
                <s:select name="ass.type" list="{'exercise','deliverable'}"/>
            </td>
        </tr>
        <tr>
            <td class="tdLabel">To Range</td>
            <td><s:textfield name="ass.toRange" size="40"/> 
                <s:fielderror><s:param>ass.toRange</s:param></s:fielderror></td>
        </tr>
        <tr>
            <td class="tdLabel">From Range</td>
            <td><s:textfield name="ass.fromRange" size="40"/> 
                <s:fielderror><s:param>ass.fromRange</s:param></s:fielderror></td>
        </tr>
        <tr>    
        <table>
            <tr>
                <td>
            <tr>
                <td>
                    <br/>
                    <label> <b>Assessment Item Details below : </b></label>
                    <br/> <br/>
                </td>
            </tr> 
            <tr>
                <td class="tdLabel"><s:text name="Assessment Description"/>:</td>
                <td ><s:textfield id="desc" name="description" size="40"/>  </td>
            </tr>
            <tr>
                <td class="tdLabel"><s:text name="assessmentitem.weight"/>:</td>
                <td><s:textfield id="weight" name="weight" size="40"/></td>
            </tr>
            <tr>
                <td class="tdLabel"><s:text name="assessmentitem.toRange"/>:</td>
                <td><s:textfield id="toRange" name="toRange" size="10"/> 
                    <s:fielderror><s:param>toRange</s:param></s:fielderror></td>
            </tr>
            <tr>
                <td class="tdLabel"><s:text name="assessmentitem.fromRange"/>:</td>
                <td><s:textfield id="fromRange" name="fromRange" size="10"/> 
                    <s:fielderror><s:param>fromRange</s:param></s:fielderror></td>
            </tr>
            <tr>
                <td colspan="2">
                    <br/>
                    <input type="button" value="Add More Assessment Items" onclick="refreshList()"/>
                </td>
            </tr>
            </td>                
            </tr>                         
        </table>
        <table>
            <tr>
                <td >
                    The Assessment Items added so far :<br/>
                    <s:textarea id="area" name="listOfassessmentItems" rows="8" cols="50" value=""></s:textarea>
                </td>

            </tr>
        </table>    

    </tr>
    <tr>
        <td>
            <br/>
            <s:submit label="assessment.button"/>
            &nbsp;&nbsp;&nbsp;
            <s:submit key="cancel" label="assessment.cancel"/>
        </td>
    </tr>
</table>
</s:form>


<SCRIPT language="javascript">
      
    function refreshList(){
        var description=document.form.description.value;
        var weight=document.form.weight.value;
        var toRange=document.form.toRange.value;
        var fromRange=document.form.fromRange.value;
       
        var textarea = document.getElementById('area');
        textarea.value = textarea.value +":"+description +" "+weight+" "+toRange+" "+fromRange+"\n"; 
   
        document.getElementById('desc').value="";
        document.getElementById('weight').value="";
        document.getElementById('toRange').value="";
        document.getElementById('fromRange').value="";
    }
      
</SCRIPT> 

